<?php

class Salas_model extends CI_Model {

    public function __construct() {
        $this->load->database();
    }

   
    public function insert($arr_insert){
        $this->db->insert('salas',$arr_insert);
        
        
    }
    
    
    public function get_salas($slug = FALSE) {
        if ($slug === FALSE) {               //SELECT * FROM news
            $query = $this->db->get('salas');
            //Returnarray devuelve toods los resultados
            return $query->result_array();
        }

        $query = $this->db->get_where('salas', array('cod_cine' => $slug));
        return $query->result_array();
    }

    public function get_cine_sala($slug = FALSE){
            if ($slug === FALSE) {               //SELECT * FROM news
            $query = $this->db->get('cines');
                return $query->result_array();
    }
      $query = $this->db->get_where('cines', array ('cod_cine' => $slug));
        return $query->result_array();
}
 
 public function get_datos_cine($slug = FALSE){
            if ($slug === FALSE) {               //SELECT * FROM news
            $query = $this->db->get('cines');
                return $query->result_array();
    }
      $query = $this->db->get_where('cines', array ('cod_cine' => $slug));
        return $query->result_array();
}
//get peliculas sala-> falta concretar para añadir las peliculas en la base de datos en el apartado de salas
public function get_pelicula_sala($slug = FALSE){
            if ($slug === FALSE) {               //SELECT * FROM news
            $query = $this->db->get('cines');
                return $query->result_array();
    }
      $query = $this->db->get_where('cines', array ('cod_cine' => $slug));
        return $query->result_array();
}

} 
 